package com.example.demo.controller;

import com.example.demo.common.BasePageResponse;
import com.example.demo.common.ResultObject;
import com.example.demo.jooq.tables.pojos.Apply;
import com.example.demo.jooq.tables.pojos.ShopOrder;
import com.example.demo.model.request.ApplyPageRequest;
import com.example.demo.model.request.ApplyRequest;
import com.example.demo.model.response.AddressResponse;
import com.example.demo.model.response.ApplyPageResponse;
import com.example.demo.service.order.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("v1/apply/")
public class ApplyController {

    @Autowired
    private IOrderService iOrderService;
    @GetMapping(value = "list")
    public ResultObject<BasePageResponse<ApplyPageResponse>> queryPageApplyList(ApplyPageRequest applyPageRequest) {
        return iOrderService.queryPageApplyList(applyPageRequest);
    }

    /**
     * 账户保存
     * @param apply 数据对象
     * @return
     */
    @PostMapping(value = "save")
    public ResultObject  saveAddress(@RequestBody ApplyRequest apply) {
        return iOrderService.saveApply(apply);
    }

    /**
     * 查询下单详情
     * @param applyId 数据对象
     * @return
     */
    @GetMapping(value = "detail")
    public ResultObject  queryApplyDetail(@RequestParam("applyId")String applyId) {
        return iOrderService.queryApplyDetail(applyId);
    }
}
